﻿using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using Microsoft.Scripting.Runtime;

namespace CodeMaker.Test
{
    class Program
    {
        private static ScriptEngine engine;

        static void Main(string[] args)
        {
            try
            {
                engine = Python.CreateEngine();
                ScriptScope scope = engine.CreateScope();
                engine.SetVariable(scope, "type", "Int32");
                engine.SetVariable(scope, "typeValue", "row[\"ID\"].ToString()");
                ScriptScope resultScope = engine.ExecuteFile("test.py", scope);
                Console.WriteLine(resultScope.GetVariable("result"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.ReadLine();
            }
        }
    }
}
